package com.loong.news.controller.backend;

import com.loong.common.domain.BaseQuery;
import com.loong.common.mvc.BaseBackendController;
import com.loong.common.param.BaseIdParam;
import com.loong.common.rest.Result;
import com.loong.common.validator.group.CommonValidate;
import com.loong.news.common.backend.result.NewsOperationRecordResult;
import com.loong.news.handler.NewsOperationRecordHandler;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description: 处理新闻操作记录的controller
 * @Author: 刘群
 * @Date: 2020/10/15 17:48
 */
@RestController
@RequestMapping("manage/news/operationRecord")
public class NewsOperationRecordController extends BaseBackendController {
    @Resource
    private NewsOperationRecordHandler recordHandler;

    /**
     * 分页查询新闻的操作记录
     * @param query 查询参数
     * @param newsId 新闻id
     * @return 响应的结果
     */
    @PostMapping("select")
    public Result findRecordsByNewsId(BaseQuery query, @RequestParam("newsId") Long newsId){
        return handlerExecutor.execute(() -> recordHandler.findRecordsByNewsId(query,newsId));
    }
}
